﻿using UnityEngine;
using System.Collections;

public abstract class IModBase
{
    protected readonly OwnerObj ownerObj;

    protected ModuleManager moduleManager;

    public IModBase(OwnerObj ownerObj)
    {
        this.ownerObj = ownerObj;
    }

    public static T CreateFactory<T>(OwnerObj ownerObj) where T : IModBase
    {
        if (typeof(T) == typeof(ModBlood))
        {
            return (T)((IModBase)(new ModBlood(ownerObj)));
        }

        return default(T);
    }

    public void SetModule(ModuleManager moduleManager)
    {
        this.moduleManager = moduleManager;
    }

    protected ModuleManager GetModule()
    {
        return moduleManager;
    }

    public virtual void Load() { }

    public virtual void UnLoad() { }

    /// <summary>
    /// 更新
    /// </summary>
    /// <param name="deltaTime"></param>
    public virtual void Update(float deltaTime) { }
}
